package com.social.share.ssm.controller;

import com.social.share.ssm.service.DemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by churcy on 2017/5/8.
 */

@Controller
public class DemoController {

    @Autowired
    private DemoService demoService;

    @RequestMapping(value = "/")
    @ResponseBody
    public String index(HttpServletRequest request){
        String index = "首页";
        return index;
    }

    @RequestMapping(value = "/demo/test")
    @ResponseBody
    public Object doSomething(HttpServletRequest request){
        System.out.println("this is controller,doSomething");
        Map<String,Object> result = new HashMap<>();
        demoService.showSomething(result);

        return result;
    }

}
